﻿{template 'header'}
{if $reply['status']==0 || $reply['status']==""}
<div class="alert alert-warning" style="text-align:center;position: fixed;top:40%;z-index: 2; width:80%;margin:0 10%;">活动已禁用！</div>
<div class="weui_mask"></div>
{/if}
<script src="{MODULE_URL}/template/static/js/jquery.masonry.min.js"></script>
<div class="divmain1"><img src="{php echo tomedia($reply['topimg']);}" alt="shareImg"></div>

<div class="num_box">
	<ul class="num_box_ul">
		<li><span class="text">已报名</span> <span>{$jointotal}</span></li>
		<li><span class="text">累计投票</span> <span>{$votetotal}</span></li>
		<li><span class="text">访问量</span> <span>{$pvtotal}</span></li>
	</ul>
<span>
{if $voteuser['id']!=""}
<div class='join_us'><a href='{php echo $this->createMobileUrl('view', array('rid' => $reply['rid'],'id'=>$voteuser['id']))}'>我的投票</a></div>
{else}
<div class='join_us'><a href='{php echo $this->createMobileUrl('join', array('rid' => $reply['rid']))}'>我要报名</a></div>
{/if}


</span>

</div>

<div class="divmain11 clearfix">
  <input type="text" value="" name="sci" placeholder="请输入编号或姓名" class="inputtxt">
  <div class="divsub" onclick="get_list(1);">搜&nbsp;索</div>
</div>

<div class="divmain12 clearfix">
  <div class="divitem"> 
    <div class="divtxt"><a href="{php echo $this->createMobileUrl('ranking', array('rid' => $rid))}">票数榜</a></div>
    <div class="divline"></div>
  </div>
  <div class="divitem"> 
    <div class="divtxt"><a href="{php echo $this->createMobileUrl('ranking', array('rid' => $rid,'ty' =>1))}">钻石榜</a></div>
  </div>
</div>

<section class="content" id="toupiao">
<div id="pageCon" style="padding-bottom: 10px">
<ul class="list_box clearfix" id="list_box" style="position: relative;">
</ul>
<div id="list_more" class="box" style="margin-top: 16px; text-align: center;margin-bottom: 40px;"><span class="am-text-secondary" onclick="get_list(0);">查看更多</span></div>
</div>
</section>

<div style="clear:both;"></div>
<!--div class="page">
          <div class="page1">上一页</div>
              <div class="page3"><a href="main.php?orders=&sci=&page=2">下一页</a></div>
        
</div -->

<div class="divmain10">
  <div class="divxian">
    <div class="divtxt">活动奖品</div>
  </div>
  <div class="divcon">{$reply['prizemsg']}</div>
  <div class="divxian" style="margin-top:40px;">
    <div class="divtxt">活动介绍</div>
  </div>
  <div class="divcon">{$reply['infomsg']}</div>
  <div class="divxian" style="margin-top:40px;">
    <div class="divtxt">投票规则</div>
  </div>
  <div class="divcon">{$reply['eventrule']}</div>
</div>

<div class="copyright"></div>

{template 'nav_footer'}

<script type="text/javascript">
var limit = 1;
function get_list(ty){
    
    if(ty==1){
	   var keyword=$("input[name='sci']").val();
	   if(keyword==""){
	      dialog2("请输入编号或姓名");
		  return false;
	   }
	   $("#pageCon .list_box").html('');
	}else{
	   $("#list_more").html('<div class="am-text-secondary"><span class="am-icon-spinner am-icon-spin"></span> 卖命加载中...</div>');
	   var keyword="";
	}
	
	$.ajax({
	    type : "post",
	    url : "{php echo $this->createMobileUrl('Index',array('rid'=>$rid))}",
	    data : {
	    	limit:limit,
			keyword:keyword
	    },
        dataType : "json",		
	    success : function(data) {
	    	if(data.status==200){
						var list = data.content;
						var content = '';
						for(var i=0; i<list.length; i++){
							content += '<li class="picCon"><div>'
							+'<i class="number">'+list[i]['id']+'号</i>'
							+'<a href="'+list[i]['url']+'" class="img"><img src="'+list[i]['img1']+'"></a>'
							+'<div class="clearfix"><p>'+list[i]['name']+'&nbsp;&nbsp;'+list[i]['votenum']+'票</p>'
							+'<a href="'+list[i]['url']+'" class="vote">投票</a></div>'
							+'</div></li>';
							
						}
                        $("#pageCon .list_box").append(content);
						if(list.length==10){
							$("#list_more").html('<span class="am-text-secondary" onclick="get_list(0);">查看更多</span>');
						}else{
							$("#list_more").html('<span></span>');
						}		
	                    limit++;

						

waterfall();
		    }else if(data.status==-103){
	    		$("#list_more").html('<span>没有更多记录！</span>');
	    	}else if(data.status==301){
	    		$("#list_more").html('<span>没有搜索到内容！</span>');
	    	}else{
			    $("#list_more").html('<span>没有更多记录！</span>');
			}    	
	    },
	    error : function(xhr, type) {

	    }
	});
	    

}
get_list(0);

function waterfall(limit){
$container = $('#list_box');
$container.masonry('reload');
	$container.imagesLoaded(function() {
		$container.masonry({
			itemSelector: '.picCon',
			gutter: 20,
			isAnimated: true,
			});
		});
}

        
</script>

{template 'footer'}